﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace TankGame
{
    public class Bullet
    {
        public Vector2 Position, Velocity;
        public float Life, Direction;
        public ParticleEngine2 Emitter;

        public Bullet(Vector2 Position, Vector2 Velocity, float Life, float Direction, List<Texture2D> EngineList)
        {
            this.Position = Position;
            this.Velocity = Velocity;
            this.Life = Life;
            this.Direction = Direction;

            this.Emitter = new ParticleEngine2(EngineList, this.Position);
        }

        public void Update(GameTime gameTime)
        {
            float Delta = gameTime.ElapsedGameTime.Milliseconds * 0.001f;

            this.Position += Velocity * Delta;
            this.Life -= Delta;
            this.Emitter.EmitterLocation = this.Position;
            this.Emitter.Update();
        }
    }
}
